<template>
  <div>
    <home-header></home-header>
    <home-list
      :typeList="typeList"
    ></home-list>
  </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeList from './components/List'

import axios from 'axios'
const dburl = '/api/movie/in_theaters'
export default {
  name: 'Home',
  data () {
    return {
      typeList: []
    }
  },
  components: {
    HomeHeader,
    HomeList
  },
  methods: {
    getHomeList () {
      axios.get(dburl, {
        emulateJSON: true,
        params: {
          headers: {'Content-Type': 'application/x-www-form-urlencoded'}
        }
      }).then(this.getHomeListSucc)
    },
    getHomeListSucc (res) {
      res = res.data
      if (res) {
        const data = res.subjects
        this.typeList = data
      }
    }
  },
  mounted () {
    this.getHomeList()
  },
  created () {

  }
}
</script>

<style scoped lang="stylus">

</style>
